//
//  HeadView.m
//  Game2048
//
//  Created by mis on 16/3/25.
//  Copyright © 2016年 mis. All rights reserved.
//

#import "HeadView.h"

@implementation HeadView

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        self.frame = frame;
    }
    return self;
}

- (UIButton *)leftMenuBtn {
    if (!_leftMenuBtn) {
        _leftMenuBtn = [[UIButton alloc] initWithFrame:CGRectMake(10, 10, 40, 40)];
        [_leftMenuBtn setImage:[UIImage imageNamed:@"left_menu_btn"] forState:UIControlStateNormal];
        _leftMenuBtn.clipsToBounds = YES;
        _leftMenuBtn.layer.cornerRadius = 5;
        
    }
    return _leftMenuBtn;
}

- (UIButton *)rightMenuBtn {
    if (!_rightMenuBtn) {
        _rightMenuBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.frame.size.width - 50, 10, 40, 40)];
        [_rightMenuBtn setImage:[UIImage imageNamed:@"right_menu_btn"] forState:UIControlStateNormal];
    }
    return _rightMenuBtn;
}

- (UIButton *)refeshBtn {
    if (!_refeshBtn) {
        _refeshBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.frame.size.width - 90, 10, 40, 40)];
        [_refeshBtn setImage:[UIImage imageNamed:@"refresh_btn"] forState:UIControlStateNormal];
    }
    return _refeshBtn;
}

- (void)drawRect:(CGRect)rect {
    [self addSubview:self.leftMenuBtn];
    [self addSubview:self.rightMenuBtn];
    [self addSubview:self.refeshBtn];
}
@end
